<?
/*
Input params:
    - quick_mode
    - monitor_id
*/
$monitor_id = $monitor->id;

$r = "../";
require_once($r."_inc/c_table_generator.php");
require_once($r."_header_ext.php");

GetResStorageList($monitor_id, 5, $rsl);
$n = count($rsl);
if ($n > 0)
{
?>

<table border="1" cellspacing="0" cellpadding="2" 
    class="tblSmall" style="width: 100%;">
<tr>
	<td class="tblSmallHTD"><span class="textSmall">DATE</td>
	<td class="tblSmallHTD"><span class="textSmall">RESULT</td>
	<td class="tblSmallHTD"><span class="textSmall">NOTES</td>
</tr>
<?php
$template_tbl_small_row = '
<tr>
	<td class="tblSmallTD"><span class="textSmall">[%DATE%]</td>
	<td class="tblSmallTD"><span class="textSmall">[%RESULT%]</td>
	<td class="tblSmallTD"><span class="textSmall">[%NOTES%]</td>
</tr>
';

//echo "<pre>"; var_dump($rsl); echo "</pre>";

for ($i=0; $i < $n; $i++)
{
	$rs = $rsl[$i];
	
	if ($rs->data["resource_status"] == RESOURCE_STORAGE_STATUS_FAKE) continue;
	
	$do_link = true;
    /*
    $do_link = ($rs->data["resource_status"] == RESOURCE_STORAGE_STATUS_CHANGED) ||
	           ($rs->data["resource_status"] == RESOURCE_STORAGE_STATUS_TRIGGERED);
    */
    
	$a1 = "";
	$a2 = "";
	if ($do_link && ($i+1 < $n))
	{
		$a1 = '<a href="history_nav.php'.
			'?monitor_id='.$monitor->id.
			'&resource_id='.$rs->id.
			'" xtarget="_blank">';
		$a2 = '</a>';
	}
     
    $notes = '&nbsp;';
    if ($rs->data["resource_status"] == RESOURCE_STORAGE_STATUS_CHANGED)
    {
        $notes = 'Page updated, no keywords found';
    }
    
    echo process_template($template_tbl_small_row, array(
        'DATE'      => $rs->GetScanDTStr(),
        'RESULT'    => $a1 . $rs->GetScanResult(@$rsl[$i+1]) . $a2,
        'NOTES'     => $notes,
    ));
}
?>
</table>

<?
} /* ($n > 0) */
?>